<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:v="http://shale.apache.org/validator">

<f:view>
<f:loadBundle var="text" basename="#{itemForm.bundleName}"/>
    <head>
        <title>#{text['itemDetail.title']}</title>
        <meta name="heading" content="#{text['itemDetail.heading']}"/>
        <meta name="menu" content="ItemMenu"/>
    </head>
<body id="itemForm">

<h:form id="itemForm">
<h:inputHidden value="#{itemForm.item.objectId}" id="objectId"/>

<h:panelGrid columns="3">

    <h:outputLabel styleClass="desc" for="name" value="#{text['item.name']}"/>
    <h:inputText styleClass="text medium" id="name" value="#{itemForm.item.name}"/>
    <t:message for="name" styleClass="fieldError"/>

    <h:outputLabel styleClass="desc" for="description" value="#{text['item.description']}"/>
    <h:inputText styleClass="text large" id="description" value="#{itemForm.item.description}"/>
    <t:message for="description" styleClass="fieldError"/>
    
    <h:outputLabel styleClass="desc" for="extId" value="#{text['item.extId']}"/>
    <h:inputText styleClass="text medium" id="extId" value="#{itemForm.item.extId}"/>
    <t:message for="extId" styleClass="fieldError"/>

    <h:panelGroup styleClass="buttonBar bottom">
        <h:commandButton value="#{text['button.save']}" action="#{itemForm.save}" id="save" styleClass="button_small"/>

        <c:if test="${not empty itemForm.item.objectId}">
        <h:commandButton value="#{text['button.delete']}" action="#{itemForm.delete}" 
            id="delete" styleClass="button_small"/>
        </c:if>

        <h:commandButton value="#{text['button.cancel']}" action="cancel" immediate="true"  
            id="cancel" styleClass="button_small"/>
    </h:panelGroup>
    <h:outputText/><h:outputText/>
</h:panelGrid>
</h:form>

<script type="text/javascript">
    $('itemForm:name').focus();
    highlightFormElements();
</script>

</body>
</f:view>
</html>